package lesson5;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;

public class UdpDIckServer extends UdpEchoServer{
    HashMap<String, String> dick = new HashMap<>();
    public UdpDIckServer(int port) throws SocketException {
        super(port);
        dick.put("小猫", "cat");
        dick.put("小狗", "dog");
        dick.put("苹果", "apple");

    }

    @Override
    public String process(String request) {
        return dick.getOrDefault(request, "词典没有这个单词");
    }

    public static void main(String[] args) throws IOException {
        UdpDIckServer server = new UdpDIckServer(9090);
        server.start();
    }
}
